import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import vueSetupExtend from 'vite-plugin-vue-setup-extend'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(
    {
      reactivityTransform: true
    }
  ), vueSetupExtend()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    // 端口
    port: 8080,
    // 默认启动浏览器
    open: true,
    // 允许ajax跨域
    cors: true,
    // 主机地址
    host: 'www.corho.com'
  },
  // 配置css 全局注入  
  css: {
    preprocessorOptions: {
      less: {
        additionalData: `
            @import "@/assets/styles/variables.less";
            @import "@/assets/styles/mixins.less";
          `
      }
    }
  }
})
